package io.github.uicdb.liba.api.register;

import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;

import java.util.function.Supplier;

public class LivingTypeBuilder<T extends LivingEntity> extends EntityTypeBuilder<T>{
    private Supplier<AttributeSupplier.Builder> builder=LivingEntity::createLivingAttributes;
    public LivingTypeBuilder(LazyRegistry lazyRegistry, String name, EntityType.EntityFactory<T> factory) {
        super(lazyRegistry, name, factory);
    }
    public LivingTypeBuilder<T> attributeLiving(Supplier<AttributeSupplier.Builder> builder){
        this.builder=builder;
        return this;
    }

    @Override
    public EntityTypeHolder<T> build() {
        super.build();
        lazyRegistry.entityAttributeMap.put(()->result.get(),builder);
        return result;
    }
}
